package com.xxbb.chapter_1.dome3_getPI;

public class Program {
    public static void main(String[] args) {
    	//求π值
        double denominator = 1,
                t = 1,
                sum = 0;
        int s = 1;
        while (Math.abs(t) >= 1e-8) {
            sum += t;
            denominator += 2;
            s *= -1;
            t = s / denominator;
        }
        double pi = sum * 4;
        System.out.println("pi=" +pi);
    }
}
